import request from '@/utils/request'
import MODULE from '@/utils/module'

export function getList(data, currentPage, pageSize) {
    return request({
        url: MODULE.MODULE.deviceType + '/DeviceType/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        //url:  "http://127.0.0.1:8765"+MODULE.MODULE.deviceType + '/DeviceType/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function doDelete(id) {
    return request({
        url: MODULE.MODULE.deviceType +  '/DeviceType/remove',
        //url:"http://127.0.0.1:8765"+ MODULE.MODULE.deviceType +  '/DeviceType/remove',
        method: 'delete',
        params: { id }
    })
}

// 编辑
export function doEdit(data) {
    return request({
        url: MODULE.MODULE.deviceType +  '/DeviceType/edit',
        //url: "http://127.0.0.1:8765"+MODULE.MODULE.deviceType +  '/DeviceType/edit',
        method: 'PATCH',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


//查询货道信息
export function getDeviceAisleTemplateList(data, currentPage, pageSize) {
    return request({
        //url: MODULE.MODULE.deviceAisle + '/deviceAisle/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        url:  MODULE.MODULE.deviceAisleTemplate + '/DeviceAisleTemplate/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


// 编辑
export function aisleTemplateDoEdit(data) {
    return request({
        //url: MODULE.MODULE.deviceType +  '/DeviceType/edit',
        url: MODULE.MODULE.deviceAisleTemplate +  '/DeviceAisleTemplate/edit',
        method: 'PATCH',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


export function aisleTemplatedoDelete(id) {
    return request({
        //url: MODULE.MODULE.deviceType +  '/DeviceType/remove',
        url:"http://127.0.0.1:8765"+ MODULE.MODULE.deviceAisleTemplate +  '/DeviceAisleTemplate/remove',
        method: 'delete',
        params: { id }
    })
}


//查询商品模板信息
export function getDeviceGoodsTemplateList(data, currentPage, pageSize) {
    return request({
        //url: MODULE.MODULE.deviceAisle + '/deviceAisle/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        url:  "http://127.0.0.1:8765"+MODULE.MODULE.deviceAisleTemplateItem + '/DeviceAisleTemplateItem/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


// 商品模板信编辑
export function goodsTemplateDoEdit(data) {
    return request({
        //url: MODULE.MODULE.deviceType +  '/DeviceType/edit',
        url: "http://127.0.0.1:8765"+MODULE.MODULE.deviceAisleTemplateItem +  '/DeviceAisleTemplateItem/edit',
        method: 'PATCH',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

//删除
export function  goodsTemplatedoDelete(id) {
    return request({
        //url: MODULE.MODULE.deviceType +  '/DeviceType/remove',
        url:"http://127.0.0.1:8765"+ MODULE.MODULE.deviceAisleTemplateItem +  '/DeviceAisleTemplateItem/remove',
        method: 'delete',
        params: { id }
    })
}


export function getDevicetList(data, currentPage, pageSize) {
    return request({
        url: MODULE.MODULE.device + '/Device/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        // url:  "http://127.0.0.1:8765"+MODULE.MODULE.device + '/Device/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



// 应用模板
export function applyTemplate(data) {
    return request({
        //url:MODULE.MODULE.deviceAisle +'/DeviceAisle/applyTemplate',
        url: MODULE.MODULE.deviceAisle +'/DeviceAisle/applyTemplate',
        method: 'PATCH',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



//查询商品库
export function getGoodsPriceList(data, currentPage, pageSize) {
    return request({
        url: MODULE.MODULE.goodsPrice + '/GoodsPrice/getGoodsPriceList/' + pageSize + '/' + currentPage,
        // url:  "http://127.0.0.1:8765"+MODULE.MODULE.device + '/Device/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}